package com.stxx.stiot2.utils;

import com.stxx.stiot2.external.RedisServer;
import com.stxx.stiot2.gateway.GatewayUtils;
import com.stxx.stiot2.service.AlarmService;
import com.stxx.stiot2.service.EventLogService;
import com.stxx.stiot2.service.SignalService;
import com.stxx.stiot2.service.TerminalService;
import lombok.Getter;
import org.noear.solon.Solon;
import org.noear.solon.annotation.Component;
import org.noear.solon.annotation.Init;

import java.util.concurrent.Executor;

@Component
public class ServerUtils {

    @Getter
    private static RedisServer redisServer;
    @Getter
    private static AlarmService alarmService;
    @Getter
    private static Executor executor;
    @Getter
    private static EventLogService eventLogService;
    @Getter
    private static GatewayUtils gatewayUtils;
    @Getter
    private static TerminalService terminalService;
    @Init
    public void start() {
        redisServer = Solon.context().getBean(RedisServer.class);
        alarmService = Solon.context().getBean(AlarmService.class);
        executor = Solon.context().getBean(Executor.class);
        eventLogService = Solon.context().getBean(EventLogService.class);
        gatewayUtils = Solon.context().getBean(GatewayUtils.class);
        terminalService = Solon.context().getBean(TerminalService.class);
    }
}
